//
//  YHModuleTwoViewController_3.m
//  YHRouter_Example
//
//  Created by 98du on 2021/12/2.
//  Copyright © 2021 林宁宁. All rights reserved.
//

#import "YHModuleTwoViewController_3.h"
@import YHRouter;

@interface YHModuleTwoViewController_3 ()

@property (assign, nonatomic) BOOL isLogined;

@end

@implementation YHModuleTwoViewController_3

+(void)load{
    [YHRouter yh_bindKey:@"needlogin" vcClass:self];
}

-(void)yh_routerPassParams:(YHRouterParam *)parameters{
    self.isLogined = parameters.arg1?[parameters.arg1 boolValue]:NO;
}

-(BOOL)yh_routerNeedLoginFirst{
    return !self.isLogined;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    
    UIButton * btnPush = [UIButton buttonWithType:(UIButtonTypeSystem)];
    [btnPush setTitle:@"Push" forState:(UIControlStateNormal)];
    [btnPush addTarget:self action:@selector(pushEvent) forControlEvents:(UIControlEventTouchUpInside)];
    btnPush.frame = CGRectMake(0, 320, CGRectGetWidth(self.view.frame), 44);
    [self.view addSubview:btnPush];
}

- (void)pushEvent{
    [YHRouter yh_pushKey:@"YHModuleTwoViewController_4" params:[YHRouterParam params:@"update content", nil]];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
